#coding:utf-8
from telnetlib import EC
from selenium import webdriver
from bs4 import BeautifulSoup
from time import sleep
from webCrawler import WebCrawler
ctripd=WebCrawler()
ctripd.wd.get('https://www.ctrip.com/')
ctripd.wd.implicitly_wait(3)
h1 = ctripd.wd.current_window_handle
ctripd.wd.find_element_by_id('nav_vac').click()
ctripd.wd.find_element_by_class_name('start_city_station').click()
ctripd.wd.find_element_by_link_text('上海').click()
ctripd.wd.implicitly_wait(2)
ctripd.wd.find_element_by_xpath("//*[@class='destination_col']//p//a").click()
hanales=ctripd.wd.window_handles
ctripd.wd.switch_to.window(hanales.pop())
# print(ctripd.wd.current_url)
datas=ctripd.wd.find_elements_by_class_name('list_product_right')
#记录当前网址
bigroute = []

for data in datas:
    # print(data.get_attribute("title"))
    # if data
    result = data.text.replace('\n','*')
    print(result)




    # if ('万' in result[2]): # 如果出游人数过万，提取线路id到bigroute里，等待后继处理
    #     bigroute.append()





# print(data)